<?php
/**
 * mock_fmw_api
 * PioneerController.php
 * @author: Heze
 * Date: 2024/8/12 18:24
 */

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;

class UploadLoginOperationController
{
    protected $baseUrl = '/api/upload-login-operation/';

    public function index(Request $request)
    {
        return [
            "status" => true,
            "msg" => "上传成功",
        ];

        $method = $request->get('method');
        if (!empty($method)) {
            $method = str_replace('.', '_', $method);
        } else {
            $url = $request->get('s');
            $methodUrl = str_replace($this->baseUrl, '', $url);
            if (!empty($methodUrl)) {
                $method = str_replace(['/', '-'], '_', $methodUrl);
            } else {
                return [];
            }
        }

        if (!method_exists($this, $method)) {
            echo sprintf("[%s] mock function not exists", $method);
            exit;
        }

        return $this->$method($request);
    }
}
